From 211e84b39af8ebe4834f6c4d8b046f4248f14f71 Mon Sep 17 00:00:00 2001 From: "smh22@firebug.cl.cam.ac.uk" Date: Sun, 9 Oct 2005 16:26:08 +0100 Subject: [PATCH] Fix cpu hotplug issue with SMP guests (including save/restore). Was a nasty one - worth ensuring we cast to u64 whenever playing with Xen time values. Signed-off-by: Steven Hand --- linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c | 2 +- linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c index 2a9213decb..79d5b93d46 100644 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c @@ -1578,7 +1578,7 @@ void smp_suspend(void) void smp_resume(void) { smp_intr_init(); - local_setup_timer_irq(); + local_setup_timer(); } void vcpu_prepare(int vcpu) diff --git a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c index 4642ddd1ad..ea09ebbb95 100644 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c @@ -122,7 +122,7 @@ static u32 shadow_tv_version; static u64 processed_system_time; /* System time (ns) at last processing. */ static DEFINE_PER_CPU(u64, processed_system_time); -#define NS_PER_TICK (1000000000L/HZ) +#define NS_PER_TICK (1000000000ULL/HZ) static inline void __normalize_time(time_t *sec, s64 *nsec) { @@ -800,9 +800,9 @@ static inline u64 jiffies_to_st(unsigned long j) delta = j - jiffies; /* NB. The next check can trigger in some wrap-around cases, * but that's ok: we'll just end up with a shorter timeout. */ - if (delta < 1) + if (delta < 1) delta = 1; - st = processed_system_time + (delta * NS_PER_TICK); + st = processed_system_time + ((u64)delta * NS_PER_TICK); } while (read_seqretry(&xtime_lock, seq)); return st; @@ -816,7 +816,7 @@ void stop_hz_timer(void) { unsigned int cpu = smp_processor_id(); unsigned long j; - + /* s390 does this /before/ checking rcu_pending(). We copy them. */ cpu_set(cpu, nohz_cpu_mask); -- 2.30.2